package com.ease.dao;

import java.util.List;
import java.util.Map;

import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.jdbc.core.namedparam.SqlParameterSource;

import com.ease.actionscript.Remoting;
import com.ease.common.vo.Ordering;
import com.ease.common.vo.Pagination;
import com.ease.dao.jdbctemplate.core.StoredProcedureParam;

/**
 * 
 * @author nathanleewei
 * 
 */
public interface JdbcTemplateDataAccessObject extends AbstractDataAccessObject {

	JdbcTemplate getJdbcTemplate();

	NamedParameterJdbcTemplate getNamedParameterJdbcTemplate();

	/** sequence */
	long sequence(String sequenceName);

	/** create */
	int create(String namedStatement, SqlParameterSource sqlParameterSource);

	int create(String namedStatement, Map<String, Object> parameter);

	/** findInt */
	int findInt(String namedStatement, SqlParameterSource sqlParameterSource);

	int findInt(String namedStatement, Map<String, Object> parameter);

	int findInt(String namedStatement);

	/** findLong */
	long findLong(String namedStatement, SqlParameterSource sqlParameterSource);

	long findLong(String namedStatement, Map<String, Object> parameter);

	long findLong(String namedStatement);

	/** findOne */
	@Deprecated
	<T> T findOne(String namedStatement, String onlyParameterKey, Object onlyParameterValue, RowMapper<T> rowMapper);

	@Deprecated
	<T> T findOne(String namedStatement, SqlParameterSource sqlParameterSource, RowMapper<T> rowMapper);

	@Deprecated
	<T> T findOne(String namedStatement, Map<String, Object> parameter, RowMapper<T> rowMapper);

	@Deprecated
	<T> T findOne(String namedStatement, Object parameter, RowMapper<T> rowMapper);

	@Deprecated
	<T> T findOne(String namedStatement, RowMapper<T> rowMapper);

	/** List<T> find */
	<T> List<T> find(String namedStatement, SqlParameterSource sqlParameterSource, int skipResult, int maxResult, Ordering ordering, RowMapper<T> rowMapper);

	<T> List<T> find(String namedStatement, Map<String, Object> parameter, int skipResult, int maxResult, Ordering ordering, RowMapper<T> rowMapper);

	//
	<T> List<T> find(String namedStatement, String onlyParameterKey, Object onlyParameterValue, Ordering ordering, RowMapper<T> rowMapper);

	<T> List<T> find(String namedStatement, SqlParameterSource sqlParameterSource, Ordering ordering, RowMapper<T> rowMapper);

	<T> List<T> find(String namedStatement, Map<String, Object> parameter, Ordering ordering, RowMapper<T> rowMapper);

	<T> List<T> find(String namedStatement, Object parameter, Ordering ordering, RowMapper<T> rowMapper);

	<T> List<T> find(String namedStatement, Ordering ordering, RowMapper<T> rowMapper);

	//
	<T> List<T> find(String namedStatement, String onlyParameterKey, Object onlyParameterValue, RowMapper<T> rowMapper);

	<T> List<T> find(String namedStatement, SqlParameterSource sqlParameterSource, RowMapper<T> rowMapper);

	<T> List<T> find(String namedStatement, Map<String, Object> parameter, RowMapper<T> rowMapper);

	<T> List<T> find(String namedStatement, Object parameter, RowMapper<T> rowMapper);

	<T> List<T> find(String namedStatement, RowMapper<T> rowMapper);

	/** List<Map<String, Object>> find */
	List<Map<String, Object>> find(String namedStatement, String onlyParameterKey, Object onlyParameterValue, Ordering ordering);

	List<Map<String, Object>> find(String namedStatement, SqlParameterSource sqlParameterSource, Ordering ordering);

	List<Map<String, Object>> find(String namedStatement, Map<String, Object> parameter, Ordering ordering);

	List<Map<String, Object>> find(String namedStatement, Object parameter, Ordering ordering);

	List<Map<String, Object>> find(String namedStatement, Ordering ordering);

	//
	List<Map<String, Object>> find(String namedStatement, String onlyParameterKey, Object onlyParameterValue);

	List<Map<String, Object>> find(String namedStatement, SqlParameterSource sqlParameterSource);

	List<Map<String, Object>> find(String namedStatement, Map<String, Object> parameter);

	List<Map<String, Object>> find(String namedStatement, Object parameter);

	List<Map<String, Object>> find(String namedStatement);

	/** Pagination<T> findPagination */
	<T> Pagination<T> findPagination(String namedStatement, SqlParameterSource sqlParameterSource, Ordering ordering, Pagination<T> pagination, RowMapper<T> rowMapper);

	<T> Pagination<T> findPagination(String namedStatement, Map<String, Object> parameter, Ordering ordering, Pagination<T> pagination, RowMapper<T> rowMapper);

	<T> Pagination<T> findPagination(String namedStatement, Object parameter, Ordering ordering, Pagination<T> pagination, RowMapper<T> rowMapper);

	//
	<T> Pagination<T> findPagination(String namedStatement, SqlParameterSource sqlParameterSource, Pagination<T> pagination, RowMapper<T> rowMapper);

	<T> Pagination<T> findPagination(String namedStatement, Map<String, Object> parameter, Pagination<T> pagination, RowMapper<T> rowMapper);

	<T> Pagination<T> findPagination(String namedStatement, Object parameter, Pagination<T> pagination, RowMapper<T> rowMapper);

	<T> Pagination<T> findPagination(String namedStatement, Pagination<T> pagination, RowMapper<T> rowMapper);

	/** count */
	int count(String namedStatement, SqlParameterSource sqlParameterSource);

	int count(String namedStatement, Map<String, Object> parameter);

	int count(String namedStatement, Object parameter);

	/** update */
	int update(String namedStatement, SqlParameterSource sqlParameterSource);

	int update(String namedStatement, Map<String, Object> parameter);

	/** remove */
	int remove(String namedStatement, SqlParameterSource sqlParameterSource);

	/** remove */
	@Remoting(false)
	int remove(String namedStatement, Map<String, Object> parameter);

	/** execute */
	public void execute(String sql, SqlParameterSource sqlParameterSource);

	public void execute(String sql, Map<String, ?> parameter);

	Map<String, ?> execute(StoredProcedureParam storedProcedureParam, Map<String, Object> parameter);

}
